/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ticketmaster.util;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

/**
 *
 * @author Wei Liu
 */
public class DateTimeHelper
{
    public static Timestamp getCurrentDateTime()
    {
        return new Timestamp(System.currentTimeMillis());
    }

    public static Calendar getCurrentDateTimeCalendar()
    {
        Calendar c = new GregorianCalendar();
        c.setTimeInMillis(System.currentTimeMillis());
        return c;
    }

    public static Timestamp DateToTimestamp(Date date)
    {
        return new Timestamp(date.getTime());
    }

    public static String formatDate(Timestamp date)
    {
        return DateFormat.getDateInstance(DateFormat.LONG).format(date);
    }

    public static String formatTime(Timestamp date)
    {
        return DateFormat.getTimeInstance(DateFormat.SHORT).format(date);
    }

   
}



